/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-20 16:09:31
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-20 16:16:19
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/model/attendance/teacher_attendance_model.dart';
import 'package:flutter_data_center/utills/color_utils.dart';

class WeekItem extends StatefulWidget {
  const WeekItem({Key key, this.day}) : super(key: key);
  final Week day;

  @override
  _WeekItemState createState() => _WeekItemState();
}

class _WeekItemState extends State<WeekItem> {
  double height = 0;
  @override
  void initState() {
    super.initState();
    Future.delayed(Duration(milliseconds: 300), () {
      setState(() {
        height = widget.day.count / 7 * 95;
      });
    });
  }

  @override
  Widget build(BuildContext context) => Column(
        children: [
          Expanded(
            child: Container(
              width: 15,
              height: 95,
              margin: EdgeInsets.symmetric(
                horizontal: 10,
              ),
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(5),
                color: gColor("#F8FAF9"),
              ),
              child: Stack(
                children: [
                  Positioned(
                    bottom: 0,
                    left: 0,
                    right: 0,
                    child: AnimatedContainer(
                      height: height,
                      width: 15,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(5),
                        color: gColor("#00FFB3"),
                      ),
                      duration: Duration(seconds: 3),
                    ),
                  ),
                ],
              ),
            ),
          ),
          SizedBox(height: 5),
          Text(
            widget.day.week,
            style: TextStyle(
              fontSize: 9,
              color: gColor("#BCBCBC"),
            ),
          ),
        ],
      );
}
